import React, { Component } from 'react'
import { connect } from 'react-redux'
import ReactLoading from 'react-loading'
import { global as globalDuck } from 'ducks'
import { push } from 'connected-react-router'
import Zhiqing from 'icons/zhiqing.png'

class Auth extends Component {
  componentDidMount() {
    const {
      location, match, actionInitGlobal, link,
    } = this.props
    actionInitGlobal()
  }

  render() {
    return (
      <div className="page-loading">
        <img src={Zhiqing} style={{ height: '100px' }} alt="" />
        <ReactLoading color="#000000" height={100} width={100} type="bars" />
      </div>
    )
  }
}

const mapDispatchToProps = {
  actionInitGlobal: globalDuck.creators.actionInitGlobal,
  link: path => push(path),
}

export default connect(
  null,
  mapDispatchToProps,
)(Auth)
